<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>AngulaJ基于模块化实现MVC案例</title>
		<script type="text/javascript" src="../js/angular.min.js"></script>
	</head>
	<!--ng-app相当于入口-->
	<body >
		<!--ng-app="myapp"定义了一个模块-->
		<div ng-app="myapp" ng-controller="myctrl">
			<div>
				<!--ng-model模型作用-->
				<input type="text" name="name" ng-model="name"/>
			</div>
			<div>
				<!--{{}}等价于ng-bind数据显示-->
				Hello,{{name}}
			</div>
		</div>

		<script type="text/javascript">
			//初始化myapp模块
			var myapp=angular.module("myapp",[]);
			//定义模块的控制器
			//依赖注入，$scope作用域对象，操作当前作用域试图
			myapp.controller("myctrl",["$scope",function($scope){
				//对模型初始化赋值
				$scope.name="你好，地球";
			}]);
		</script>
	</body>
</html>
